using System.Collections;
using System.Collections.Generic;

namespace WgFrame.Utils
{
	public class Hashtable : Dictionary<object, object>
	{
		public new object this[object key]
		{
			get
			{
				object ret = null;
				TryGetValue(key, out ret);
				return ret;
			}
			set
			{
				base[key] = value;
			}
		}

		public Hashtable()
		{
		}

		public Hashtable(int x)
			: base(x)
		{
		}

		public new IEnumerator<DictionaryEntry> GetEnumerator()
		{
			return new DictionaryEntryEnumerator(((IDictionary)this).GetEnumerator());
		}

		public override string ToString()
		{
			List<string> temp = new List<string>();
			foreach (object key in base.Keys)
			{
				if (key == null || this[key] == null)
				{
					temp.Add(key?.ToString() + "=" + this[key]);
					continue;
				}
				temp.Add("(" + key.GetType()?.ToString() + ")" + key?.ToString() + "=(" + this[key].GetType()?.ToString() + ")" + this[key]);
			}
			return string.Join(", ", temp.ToArray());
		}

		public object Clone()
		{
			return new Dictionary<object, object>(this);
		}
	}
}
